
package galcon.utils;

public class Circle {
	protected Point	point;
	protected int		radius;
	
	public Circle (Point point, int radius) {
		this.point = point;
		this.radius = radius;
	}
	
	public Point getPoint () {
		return point;
	}
	
	public int getRadius () {
		return radius;
	}
	
	public void setPoint (Point point) {
		this.point = point;
	}
	
	public void setRadius (int radius) {
		this.radius = radius;
	}
	
	public boolean intersects (Circle other) {
		return this.point.distance (other.getPoint ()) < this.radius
				+ other.getRadius () + Constants.SPACE_BETWEEN_PLANETS;
	}

    public Circle clone(){
        return new Circle(new Point(this.point.getX(), this.point.getY()), this.radius);
    }

    public boolean equals(Object obj){
        if(obj instanceof Circle){
            Circle circle = (Circle)obj;
            if(this.getRadius() == circle.getRadius() &&
                    this.getPoint().equals(circle.getPoint())){
                return true;
            }
        }
        return false;
    }

    public String toString(){
        String result = "";
        result += "Circle: Radius: " + this.getRadius() + " " + this.point.toString();
        return result;
    }
}
